<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <div>
        <h1>我是B页面</h1>
        <button>获取参数</button>
        <div>

        </div>
    </div>
    <script>
        function formatSearch( str ){
            str = str.substr(1);
            var arr = str.split("&") ; 
            var obj = {} ;
            arr.forEach(function( item ){
                var newArr = item.split("=");
                obj[newArr[0]] = newArr[1] ; 
            });
            return obj ;
        }
        var btnEle1 = document.querySelector("button");
        btnEle1.onclick = function (){
            var res = window.location.search ;
            var obj = formatSearch(res) ;
            var str = '' ;
            for( var key in obj ){
                str = str + obj[key] ; 
            }
            document.querySelector("div div").innerHTML = str
        }
    </script>
</body>
</html>